#!/bin/bash
PORT=8001
NUM=$(lsof -i:$PORT | wc -l)
echo "total:$NUM"
NUM=$(expr $NUM - 1)

killprocess ()
{
    echo "kill process func"
}
if [ $NUM -gt 0 ]
then
    echo "begin:stop"
fi
needDelPID=$(lsof -i:$PORT | sed -n 2p | awk '{print($2)}')

if [ "$needDelPID" != "" ]
then
    echo "prepare stop pid:${needDelPID}"
    kill -9 $needDelPID
fi
